using System;
using System.Collections.Generic;

namespace UserManagementService.DTOs;

/// <summary>
/// 用户导入结果DTO
/// </summary>
public class UserImportResultDto
{
    /// <summary>
    /// 导入任务ID
    /// </summary>
    public string TaskId { get; set; }

    /// <summary>
    /// 总处理数量
    /// </summary>
    public int TotalCount { get; set; }

    /// <summary>
    /// 成功导入数量
    /// </summary>
    public int SuccessCount { get; set; }

    /// <summary>
    /// 失败数量
    /// </summary>
    public int FailedCount { get; set; }

    /// <summary>
    /// 跳过数量（重复数据）
    /// </summary>
    public int SkippedCount { get; set; }

    /// <summary>
    /// 更新数量
    /// </summary>
    public int UpdatedCount { get; set; }

    /// <summary>
    /// 导入开始时间
    /// </summary>
    public DateTime StartTime { get; set; }

    /// <summary>
    /// 导入结束时间
    /// </summary>
    public DateTime EndTime { get; set; }

    /// <summary>
    /// 处理时长（毫秒）
    /// </summary>
    public long Duration { get; set; }

    /// <summary>
    /// 失败记录详情
    /// </summary>
    public List<ImportErrorDto> Errors { get; set; } = new List<ImportErrorDto>();

    /// <summary>
    /// 导入成功的用户ID列表
    /// </summary>
    public List<Guid> SuccessUserIds { get; set; } = new List<Guid>();
}

/// <summary>
/// 导入错误详情DTO
/// </summary>
public class ImportErrorDto
{
    /// <summary>
    /// 行号
    /// </summary>
    public int RowNumber { get; set; }

    /// <summary>
    /// 用户名或标识
    /// </summary>
    public string UserIdentifier { get; set; }

    /// <summary>
    /// 错误消息
    /// </summary>
    public string ErrorMessage { get; set; }

    /// <summary>
    /// 错误类型
    /// </summary>
    public ImportErrorType ErrorType { get; set; }
}

/// <summary>
/// 导入错误类型枚举
/// </summary>
public enum ImportErrorType
{
    /// <summary>
    /// 数据验证失败
    /// </summary>
    ValidationError = 1,

    /// <summary>
    /// 重复数据
    /// </summary>
    Duplicate = 2,

    /// <summary>
    /// 格式错误
    /// </summary>
    FormatError = 3,

    /// <summary>
    /// 权限错误
    /// </summary>
    PermissionError = 4,

    /// <summary>
    /// 系统错误
    /// </summary>
    SystemError = 5
}